\doxysection{C\+:/\+Users/\+ASUS/\+Desktop/dm-\/ctrl\+H7-\/balance-\/9025test/bsp/dwt/bsp\+\_\+dwt.c File Reference}
\hypertarget{bsp__dwt_8c}{}\label{bsp__dwt_8c}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/bsp/dwt/bsp\_dwt.c@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/bsp/dwt/bsp\_dwt.c}}
{\ttfamily \#include "{}bsp\+\_\+dwt.\+h"{}}\newline
{\ttfamily \#include "{}cmsis\+\_\+os.\+h"{}}\newline
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{bsp__dwt_8c_a80bda377ca5cef73b03e7211b1fa18b9}{DWT\+\_\+\+Init}} (uint32\+\_\+t CPU\+\_\+\+Freq\+\_\+m\+Hz)
\begin{DoxyCompactList}\small\item\em 初始化\+DWT,传入参数为\+CPU频率,单位\+MHz \end{DoxyCompactList}\item 
float \mbox{\hyperlink{bsp__dwt_8c_af3972f1a5023286afdabf8e79abc5ed7}{DWT\+\_\+\+Get\+DeltaT}} (uint32\+\_\+t \texorpdfstring{$\ast$}{*}cnt\+\_\+last)
\begin{DoxyCompactList}\small\item\em 获取两次调用之间的时间间隔,单位为秒/s \end{DoxyCompactList}\item 
double \mbox{\hyperlink{bsp__dwt_8c_ae3519a5f8a00524b8ced263a18fbc37e}{DWT\+\_\+\+Get\+Delta\+T64}} (uint32\+\_\+t \texorpdfstring{$\ast$}{*}cnt\+\_\+last)
\begin{DoxyCompactList}\small\item\em 获取两次调用之间的时间间隔,单位为秒/s,高精度 \end{DoxyCompactList}\item 
void \mbox{\hyperlink{bsp__dwt_8c_a0f591d032752c63e190dc3d55ea959c7}{DWT\+\_\+\+Sys\+Time\+Update}} (void)
\begin{DoxyCompactList}\small\item\em DWT更新时间轴函数,会被三个timeline函数调用 \end{DoxyCompactList}\item 
float \mbox{\hyperlink{bsp__dwt_8c_ab100be84fd91e5f606bd34b2cd62ecef}{DWT\+\_\+\+Get\+Timeline\+\_\+s}} (void)
\begin{DoxyCompactList}\small\item\em 获取当前时间,单位为秒/s,即初始化后的时间 \end{DoxyCompactList}\item 
float \mbox{\hyperlink{bsp__dwt_8c_aff20f0eb6b9b6e4df5c8e509b0ca06dd}{DWT\+\_\+\+Get\+Timeline\+\_\+ms}} (void)
\begin{DoxyCompactList}\small\item\em 获取当前时间,单位为毫秒/ms,即初始化后的时间 \end{DoxyCompactList}\item 
uint64\+\_\+t \mbox{\hyperlink{bsp__dwt_8c_abf89a827c23ac1dcbb5639369d658081}{DWT\+\_\+\+Get\+Timeline\+\_\+us}} (void)
\begin{DoxyCompactList}\small\item\em 获取当前时间,单位为微秒/us,即初始化后的时间 \end{DoxyCompactList}\item 
void \mbox{\hyperlink{bsp__dwt_8c_a88912548ae8934bfc08e9c340974cab9}{DWT\+\_\+\+Delay}} (float Delay)
\begin{DoxyCompactList}\small\item\em DWT延时函数,单位为秒/s. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\begin{DoxyAuthor}{Author}
Wang Hongxi 

modified by Neo with annotation 
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}
V1.\+1.\+0 
\end{DoxyVersion}
\begin{DoxyDate}{Date}
2022/3/8 
\end{DoxyDate}


\label{doc-func-members}
\Hypertarget{bsp__dwt_8c_doc-func-members}
\doxysubsection{Function Documentation}
\Hypertarget{bsp__dwt_8c_a88912548ae8934bfc08e9c340974cab9}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_Delay@{DWT\_Delay}}
\index{DWT\_Delay@{DWT\_Delay}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_Delay()}{DWT\_Delay()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_a88912548ae8934bfc08e9c340974cab9} 
void DWT\+\_\+\+Delay (\begin{DoxyParamCaption}\item[{float}]{Delay}{}\end{DoxyParamCaption})}



DWT延时函数,单位为秒/s. 

\begin{DoxyAttention}{Attention}
该函数不受中断是否开启的影响,可以在临界区和关闭中断时使用 
\end{DoxyAttention}
\begin{DoxyNote}{Note}
禁止在\+\_\+\+\_\+disable\+\_\+irq()和\+\_\+\+\_\+enable\+\_\+irq()之间使用\+HAL\+\_\+\+Delay()函数,应使用本函数
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em Delay} & 延时时间,单位为秒/s \\
\hline
\end{DoxyParams}
\Hypertarget{bsp__dwt_8c_af3972f1a5023286afdabf8e79abc5ed7}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_GetDeltaT@{DWT\_GetDeltaT}}
\index{DWT\_GetDeltaT@{DWT\_GetDeltaT}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_GetDeltaT()}{DWT\_GetDeltaT()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_af3972f1a5023286afdabf8e79abc5ed7} 
float DWT\+\_\+\+Get\+DeltaT (\begin{DoxyParamCaption}\item[{uint32\+\_\+t \texorpdfstring{$\ast$}{*}}]{cnt\+\_\+last}{}\end{DoxyParamCaption})}



获取两次调用之间的时间间隔,单位为秒/s 


\begin{DoxyParams}{Parameters}
{\em cnt\+\_\+last} & 上一次调用的时间戳 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
float 时间间隔,单位为秒/s 
\end{DoxyReturn}
\Hypertarget{bsp__dwt_8c_ae3519a5f8a00524b8ced263a18fbc37e}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_GetDeltaT64@{DWT\_GetDeltaT64}}
\index{DWT\_GetDeltaT64@{DWT\_GetDeltaT64}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_GetDeltaT64()}{DWT\_GetDeltaT64()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_ae3519a5f8a00524b8ced263a18fbc37e} 
double DWT\+\_\+\+Get\+Delta\+T64 (\begin{DoxyParamCaption}\item[{uint32\+\_\+t \texorpdfstring{$\ast$}{*}}]{cnt\+\_\+last}{}\end{DoxyParamCaption})}



获取两次调用之间的时间间隔,单位为秒/s,高精度 


\begin{DoxyParams}{Parameters}
{\em cnt\+\_\+last} & 上一次调用的时间戳 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
double 时间间隔,单位为秒/s 
\end{DoxyReturn}
\Hypertarget{bsp__dwt_8c_aff20f0eb6b9b6e4df5c8e509b0ca06dd}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_GetTimeline\_ms@{DWT\_GetTimeline\_ms}}
\index{DWT\_GetTimeline\_ms@{DWT\_GetTimeline\_ms}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_GetTimeline\_ms()}{DWT\_GetTimeline\_ms()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_aff20f0eb6b9b6e4df5c8e509b0ca06dd} 
float DWT\+\_\+\+Get\+Timeline\+\_\+ms (\begin{DoxyParamCaption}\item[{void}]{}{}\end{DoxyParamCaption})}



获取当前时间,单位为毫秒/ms,即初始化后的时间 

\begin{DoxyReturn}{Returns}
float 
\end{DoxyReturn}
\Hypertarget{bsp__dwt_8c_ab100be84fd91e5f606bd34b2cd62ecef}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_GetTimeline\_s@{DWT\_GetTimeline\_s}}
\index{DWT\_GetTimeline\_s@{DWT\_GetTimeline\_s}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_GetTimeline\_s()}{DWT\_GetTimeline\_s()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_ab100be84fd91e5f606bd34b2cd62ecef} 
float DWT\+\_\+\+Get\+Timeline\+\_\+s (\begin{DoxyParamCaption}\item[{void}]{}{}\end{DoxyParamCaption})}



获取当前时间,单位为秒/s,即初始化后的时间 

\begin{DoxyReturn}{Returns}
float 时间轴 
\end{DoxyReturn}
\Hypertarget{bsp__dwt_8c_abf89a827c23ac1dcbb5639369d658081}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_GetTimeline\_us@{DWT\_GetTimeline\_us}}
\index{DWT\_GetTimeline\_us@{DWT\_GetTimeline\_us}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_GetTimeline\_us()}{DWT\_GetTimeline\_us()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_abf89a827c23ac1dcbb5639369d658081} 
uint64\+\_\+t DWT\+\_\+\+Get\+Timeline\+\_\+us (\begin{DoxyParamCaption}\item[{void}]{}{}\end{DoxyParamCaption})}



获取当前时间,单位为微秒/us,即初始化后的时间 

\begin{DoxyReturn}{Returns}
uint64\+\_\+t 
\end{DoxyReturn}
\Hypertarget{bsp__dwt_8c_a80bda377ca5cef73b03e7211b1fa18b9}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_Init@{DWT\_Init}}
\index{DWT\_Init@{DWT\_Init}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_Init()}{DWT\_Init()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_a80bda377ca5cef73b03e7211b1fa18b9} 
void DWT\+\_\+\+Init (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{CPU\+\_\+\+Freq\+\_\+m\+Hz}{}\end{DoxyParamCaption})}



初始化\+DWT,传入参数为\+CPU频率,单位\+MHz 


\begin{DoxyParams}{Parameters}
{\em CPU\+\_\+\+Freq\+\_\+m\+Hz} & c板为168\+MHz,A板为180\+MHz \\
\hline
\end{DoxyParams}
\Hypertarget{bsp__dwt_8c_a0f591d032752c63e190dc3d55ea959c7}\index{bsp\_dwt.c@{bsp\_dwt.c}!DWT\_SysTimeUpdate@{DWT\_SysTimeUpdate}}
\index{DWT\_SysTimeUpdate@{DWT\_SysTimeUpdate}!bsp\_dwt.c@{bsp\_dwt.c}}
\doxysubsubsection{\texorpdfstring{DWT\_SysTimeUpdate()}{DWT\_SysTimeUpdate()}}
{\footnotesize\ttfamily \label{bsp__dwt_8c_a0f591d032752c63e190dc3d55ea959c7} 
void DWT\+\_\+\+Sys\+Time\+Update (\begin{DoxyParamCaption}\item[{void}]{}{}\end{DoxyParamCaption})}



DWT更新时间轴函数,会被三个timeline函数调用 

\begin{DoxyAttention}{Attention}
如果长时间不调用timeline函数,则需要手动调用该函数更新时间轴,否则\+CYCCNT溢出后定时和时间轴不准确 
\end{DoxyAttention}
